import Captcha from 'js-captcha';

export function generateCaptcha() {
  const captcha = new Captcha();
  captcha.rotate = true;
  captcha.color = [0, 0, 0]; // 设置验证码字体颜色
  captcha.width = 200; // 设置验证码图片宽度
  captcha.height = 80; // 设置验证码图片高度
  const text = captcha.generate();
  const dataURL = captcha.getBase64();

  return {
    text,
    dataURL
  };
}
